<template>
	<view>
		<view class="listbox" v-for="(item,index) in list" :key="index">
			<view class="userinfo">
				<view class="logobox">
					<image :src="item.wxPhotoURL"></image>
				</view>
				<view class="rightbox">
					<view class="onebox">
						<view class="namebox">{{item.name}}</view>
						<view class="timebox">{{dateFormat(item.create_time)}}</view>
					</view>
					<view class="twobox">
						<view>专业度：</view>
						<uni-rate :readonly="true" color="#bbb" active-color="#FF6178" :value="item.major" :size="15" />
						<view>态度：</view>
						<uni-rate :readonly="true" color="#bbb" active-color="#FF6178" :value="item.manner"
							:size="15" />
					</view>
				</view>
			</view>
			<view class="contentbox">
				{{item.content}}
			</view>
			<view class="imgbox">
				<view class="imglist" v-for="(imgs,imgindex) in item.img.split('|')" :key="imgindex">
					<image :src="imgs"></image>
				</view>
			</view>
			<view class="specbox">
				<view class="specitem" v-for="(labitem,labindex) in item.label" :key="labindex">
					{{labitem.major_name}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "comment",
		props: {
			list: {
				type: Array,
				default: []
			}
		},
		data() {
			return {

			};
		},
		methods: {
			dateFormat: function(value) {
				var date = new Date(value * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
				var year = date.getFullYear();
				var month = ("0" + (date.getMonth() + 1)).slice(-2);
				var sdate = ("0" + date.getDate()).slice(-2);
				var hour = ("0" + date.getHours()).slice(-2);
				var minute = ("0" + date.getMinutes()).slice(-2);
				var second = ("0" + date.getSeconds()).slice(-2);
				// 拼接
				var result = year + "年" + month + "月" + sdate + "日 " //+ hour + ":" + minute //+ ":" + second;
				// 返回
				return result;
			},
		}
	}
</script>

<style lang="scss" scoped>
	.listbox {
		width: 690rpx;
		padding: 0 30rpx 20rpx 30rpx;
		background-color: #FFF;

		.userinfo {
			display: flex;
			align-items: center;
			height: 100rpx;

			.logobox {
				width: 86rpx;

				image {
					width: 70rpx;
					height: 70rpx;
					border-radius: 100%;
				}
			}

			.rightbox {
				width: 604rpx;

				.onebox {
					width: 604rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;

					.namebox {
						width: 370rpx;
						-webkit-line-clamp: 1;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						overflow: hidden;
						text-overflow: ellipsis;
					}

					.timebox {
						font-size: 28rpx;
						font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
						font-weight: normal;
						color: #555555;
					}
				}

				.twobox {
					display: flex;
					align-items: center;
					font-size: 24rpx;
					font-family: Source Han Sans CN-Regular, Source Han Sans CN;
					font-weight: 400;
					color: #555555;
					margin-top: 10rpx;
				}
			}

		}

		.contentbox {
			font-size: 28rpx;
			font-family: Source Han Sans CN-Medium, Source Han Sans CN;
			font-weight: 500;
			color: #222222;
			margin: 24rpx 0;
		}

		.imgbox {
			width: 100%;
			display: flex;
			flex-wrap: wrap;

			.imglist {
				width: 25%;
				text-align: center;

				image {
					width: 166rpx;
					height: 166rpx;
					border-radius: 8rpx;
					margin-bottom: 10rpx;
				}
			}
		}

		.specbox {
			display: flex;
			align-items: center;
			margin: 24rpx 0 0 0;
			flex-wrap: wrap;

			.specitem {
				width: fit-content;
				height: 50rpx;
				background: linear-gradient(90deg, #FEF0E5 0%, #FFE0CD 100%);
				border-radius: 8rpx 26rpx 26rpx 26rpx;
				line-height: 50rpx;
				font-size: 28rpx;
				font-family: Source Han Sans CN-Regular, Source Han Sans CN;
				font-weight: 400;
				color: #A07150;
				padding: 0 16rpx;
				margin-right: 16rpx;
				margin-top: 10rpx;
			}
		}
	}
</style>